# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=aws-sdk-cpp
pkgver=1.11.205
pkgrel=1
pkgdesc="Amazon Web Services SDK for C++"
url="https://github.com/aws/aws-sdk-cpp"
# s390x: aws-c-common
# arm*, ppc64le: aws-crt-cpp
arch="all !armhf !armv7 !ppc64le !s390x"
license="Apache-2.0"
makedepends="
	aws-c-common-dev
	aws-crt-cpp-dev
	cmake
	curl-dev
	pulseaudio-dev
	python3-dev
	samurai
	"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/aws/aws-sdk-cpp/archive/refs/tags/$pkgver.tar.gz"

_libs="
	AWSMigrationHub
	access-management
	accessanalyzer
	account
	acm-pca
	acm
	alexaforbusiness
	amp
	amplify
	amplifybackend
	amplifyuibuilder
	apigateway
	apigatewaymanagementapi
	apigatewayv2
	appconfig
	appconfigdata
	appfabric
	appflow
	appintegrations
	application-autoscaling
	application-insights
	applicationcostprofiler
	appmesh
	apprunner
	appstream
	appsync
	arc-zonal-shift
	athena
	auditmanager
	autoscaling-plans
	autoscaling
	awstransfer
	backup-gateway
	backup
	bedrock-runtime
	bedrock
	backupstorage
	batch
	billingconductor
	braket
	budgets
	ce
	chime-sdk-identity
	chime-sdk-media-pipelines
	chime-sdk-meetings
	chime-sdk-messaging
	chime-sdk-voice
	chime
	cleanrooms
	cloud9
	cloudcontrol
	clouddirectory
	cloudformation
	cloudfront
	cloudhsm
	cloudhsmv2
	cloudsearch
	cloudsearchdomain
	cloudtrail-data
	cloudtrail
	codeartifact
	codebuild
	codecatalyst
	codecommit
	codedeploy
	codeguru-reviewer
	codeguru-security
	codeguruprofiler
	codepipeline
	codestar-connections
	codestar-notifications
	codestar
	cognito-identity
	cognito-idp
	cognito-sync
	comprehend
	comprehendmedical
	compute-optimizer
	config
	connect-contact-lens
	connect
	connectcampaigns
	connectcases
	connectparticipant
	controltower
	core
	cur
	customer-profiles
	databrew
	dataexchange
	datapipeline
	datasync
	datazone
	dax
	detective
	devicefarm
	devops-guru
	directconnect
	discovery
	dlm
	dms
	docdb-elastic
	docdb
	drs
	ds
	dynamodb
	dynamodbstreams
	ebs
	ec2-instance-connect
	ec2
	ecr-public
	ecr
	ecs
	eks
	elastic-inference
	elasticache
	elasticbeanstalk
	elasticfilesystem
	elasticloadbalancing
	elasticloadbalancingv2
	elasticmapreduce
	elastictranscoder
	email
	emr-containers
	emr-serverless
	entityresolution
	es
	eventbridge
	events
	evidently
	finspace-data
	finspace
	firehose
	fis
	fms
	forecast
	forecastquery
	frauddetector
	fsx
	gamelift
	glacier
	globalaccelerator
	glue
	grafana
	greengrass
	greengrassv2
	groundstation
	guardduty
	health
	healthlake
	honeycode
	iam
	identity-management
	identitystore
	imagebuilder
	importexport
	inspector
	inspector2
	internetmonitor
	iot-data
	iot-jobs-data
	iot-roborunner
	iot
	iot1click-devices
	iot1click-projects
	iotanalytics
	iotdeviceadvisor
	iotevents-data
	iotevents
	iotfleethub
	iotfleetwise
	iotsecuretunneling
	iotsitewise
	iotthingsgraph
	iottwinmaker
	iotwireless
	ivs-realtime
	ivs
	ivschat
	kafka
	kafkaconnect
	kendra-ranking
	kendra
	keyspaces
	kinesis-video-archived-media
	kinesis-video-media
	kinesis-video-signaling
	kinesis-video-webrtc-storage
	kinesis
	kinesisanalytics
	kinesisanalyticsv2
	kinesisvideo
	kms
	lakeformation
	lambda
	launch-wizard
	lex-models
	lex
	lexv2-models
	lexv2-runtime
	license-manager-linux-subscriptions
	license-manager-user-subscriptions
	license-manager
	lightsail
	location
	logs
	lookoutequipment
	lookoutmetrics
	lookoutvision
	m2
	machinelearning
	macie2
	managedblockchain
	managedblockchain-query
	marketplace-catalog
	marketplace-entitlement
	marketplacecommerceanalytics
	mediaconnect
	mediaconvert
	medialive
	mediapackage-vod
	mediapackage
	mediapackagev2
	mediastore-data
	mediastore
	mediatailor
	medical-imaging
	memorydb
	meteringmarketplace
	mgn
	migration-hub-refactor-spaces
	migrationhub-config
	migrationhuborchestrator
	migrationhubstrategy
	mobile
	monitoring
	mq
	mturk-requester
	mwaa
	neptune
	neptunedata
	network-firewall
	networkmanager
	nimble
	oam
	omics
	opensearch
	opensearchserverless
	opsworks
	opsworkscm
	organizations
	osis
	outposts
	pca-connector-ad
	panorama
	payment-cryptography
	payment-cryptography-data
	personalize-events
	personalize-runtime
	personalize
	pi
	pinpoint-email
	pinpoint-sms-voice-v2
	pinpoint
	pipes
	polly
	pricing
	privatenetworks
	proton
	qldb-session
	qldb
	queues
	quicksight
	ram
	rbin
	rds-data
	rds
	redshift-data
	redshift-serverless
	redshift
	rekognition
	resiliencehub
	resource-explorer-2
	resource-groups
	resourcegroupstaggingapi
	robomaker
	rolesanywhere
	route53-recovery-cluster
	route53-recovery-control-config
	route53-recovery-readiness
	route53
	route53domains
	route53resolver
	rum
	s3-crt
	s3-encryption
	s3
	s3control
	s3outposts
	sagemaker-a2i-runtime
	sagemaker-edge
	sagemaker-featurestore-runtime
	sagemaker-geospatial
	sagemaker-metrics
	sagemaker-runtime
	sagemaker
	savingsplans
	scheduler
	schemas
	sdb
	secretsmanager
	securityhub
	securitylake
	serverlessrepo
	service-quotas
	servicecatalog-appregistry
	servicecatalog
	servicediscovery
	sesv2
	shield
	signer
	simspaceweaver
	sms-voice
	sms
	snow-device-management
	snowball
	sns
	sqs
	ssm-contacts
	ssm-incidents
	ssm-sap
	ssm
	sso-admin
	sso-oidc
	sso
	states
	storagegateway
	sts
	support-app
	support
	swf
	synthetics
	text-to-speech
	textract
	timestream-query
	timestream-write
	tnb
	transcribe
	transcribestreaming
	transfer
	translate
	trustedadvisor
	verifiedpermissions
	voice-id
	vpc-lattice
	waf-regional
	waf
	wafv2
	wellarchitected
	wisdom
	workdocs
	worklink
	workmail
	workmailmessageflow
	workspaces-web
	workspaces
	xray
	"

for _lib in $_libs ; do
	subpackages="$subpackages $pkgname-$_lib:library"
done

prepare() {
	default_prepare

	find src/ generated/src/ -name "CMakeLists.txt" \
		-exec sh -c 'echo "set_target_properties(\${PROJECT_NAME} PROPERTIES VERSION \${PROJECT_VERSION} SOVERSION \${PROJECT_VERSION_MAJOR}.\${PROJECT_VERSION_MINOR})" >> "$1"' sh {} \;
}

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	CFLAGS="$CFLAGS -flto=auto" \
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCUSTOM_MEMORY_MANAGEMENT=True \
		-DBUILD_DEPS=False \
		-DENABLE_TESTING=ON \
		-DAUTORUN_UNIT_TESTS=ON \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	rm -fv "$pkgdir"/usr/lib/libtesting-resources.so
}

library() {
	local name=${subpkgname#"$pkgname"-}
	pkgdesc="$pkgdesc ($name)"
	amove usr/lib/libaws-cpp-sdk-$name.so.*
}

sha512sums="
9092543f042a15df9104418ebdc482bbf7d861e7ba93e8dc101f80312c5417c3e7d8022decedee60f2f7df4248f5784adedae57bdf3af7f165365730b5a7e444  aws-sdk-cpp-1.11.205.tar.gz
"
